import request from '@/utils/request';
const creator = 'aaa'
export const getBook = () => {
    return request({
        url: '/books',
        method: 'get',
        params: {
            creator
        }
    })
}
export const getBookDetail = (id) => {
    return request({
        url: `/books/${id}`,
        method: 'get',
    })
}
export const addBook = (data) => {
    // console.log(data)
    data.creator = creator
    return request({
        url: '/books',
        method: 'post',
        data
    })
}
export const deleteBook = (id) => {
    return request({
        url: `/books/${id}`,
        method: 'delete'
    })
}
export const updateBook = (data) => {
    data.creator = creator
    console.log(data)
    return request({
        url: `/books/${data.id}`,
        method: 'put',
        data: {
            author: data.author,
            bookname: data.bookname,
            publisher: data.publisher
        }
    })
}